package com.px.business.mapper;

import com.px.business.domain.EvaluationItem;
import com.px.business.domain.dto.IndicatorRangeDTO;
import com.px.business.domain.dto.ItemRangeDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 评估明细项Mapper接口
 *
 * @author 品讯科技
 * @date 2024-08
 */
@Repository
@Mapper
public interface EvaluationItemMapper {
    /**
     * 查询评估明细项
     *
     * @param evaluationItemId 评估明细项主键
     * @return 评估明细项
     */
    EvaluationItem selectEvaluationItemByEvaluationItemId(Long evaluationItemId);

    /**
     * 查询评估明细项列表
     *
     * @param evaluationItem 评估明细项
     * @return 评估明细项集合
     */
    List<EvaluationItem> selectEvaluationItemList(EvaluationItem evaluationItem);

    /**
     * 新增评估明细项
     *
     * @param evaluationItem 评估明细项
     * @return 结果
     */
    int insertEvaluationItem(EvaluationItem evaluationItem);

    /**
     * 批量保存
     *
     * @param applicationId         申请标识
     * @param indicatorRangeDTOList 指标值域
     * @return 结果
     */
    boolean insertItemBatch(@Param("applicationId") Long applicationId, @Param("indicatorList") List<IndicatorRangeDTO> indicatorRangeDTOList);

    /**
     * 修改评估明细项
     *
     * @param evaluationItem 评估明细项
     * @return 结果
     */
    int updateEvaluationItem(EvaluationItem evaluationItem);

    /**
     * 删除评估明细项
     *
     * @param evaluationItemId 评估明细项主键
     * @return 结果
     */
    int deleteEvaluationItemByEvaluationItemId(Long evaluationItemId);

    /**
     * 批量删除评估明细项
     *
     * @param evaluationItemIds 需要删除的数据主键集合
     * @return 结果
     */
    int deleteEvaluationItemByEvaluationItemIds(Long[] evaluationItemIds);

    /**
     * 根据申请标识删除指标
     *
     * @param evaluationApplicationId
     * @return 结果
     */
    int deleteItemByApplicationId(Long evaluationApplicationId);

    /**
     * 根据申请标识获取评估项及值域
     *
     * @param applicationId 申请标识
     * @return 结果
     */
    List<ItemRangeDTO> getItemRangeByApplicationId(@Param("applicationId") Long applicationId);

    /**
     * 根据指标标识获取评估项
     *
     * @param applicationId 申请标识
     * @param indicatorIds  指标标识
     * @return 结果
     */
    List<EvaluationItem> getItemListByIndicatorIds(@Param("applicationId") Long applicationId, @Param("indicatorIds") String[] indicatorIds);

    /**
     * 根据指标标识删除评估项
     *
     * @param applicationId 申请标识
     * @param indicatorIds  指标标识
     * @return 结果
     */
    int deleteItemByIndicatorIds(@Param("applicationId") Long applicationId, @Param("indicatorIds") List<String> indicatorIds);

    /**
     * 根据申请标识查询评估项
     *
     * @param evaluationApplicationId 申请标识
     * @return 结果
     */
    List<Long> selectEvaluationItem(@Param("evaluationApplicationId") long evaluationApplicationId);

    /**
     * 查询没有自评的项
     *
     * @param evaluationApplicationId 申请标识
     * @return 结果
     */
    List<EvaluationItem> selectEvaluationItemBySelfLevelNotNull(@Param("evaluationApplicationId") long evaluationApplicationId);

    int updateEvaluationItemFile(EvaluationItem evaluationItem);

}
